home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / ACORNUSERS / CBSA / UTILS / SIZEVAR / SizeVarMsg < prev    next >
Text File  |  1998-01-15  |  3KB  |  74 lines

  1. © Copyright Nicholas Clark 1998
  2.  
  3. SizeVar is a short utility to create OS code variables which reflect the total
  4. size of and amount of free memory in various parts of system. By using
  5. appropriate command line flags (see below) any of the following variables can be
  6. created:
  7.  
  8.     System$Size
  9.     Module$Size    Module$Free
  10.     Screen$Size    Screen$Free
  11.     Sprite$Size    Sprite$Free
  12.     Font$Size    Font$Free
  13.     RAMFS$Size    RAMFS$Free
  14.  
  15. Reading a size variable (eg "*echo <Screen$Size>") gives the current memory
  16. assigned to that part of the system (in bytes - see below for kilobytes).
  17. Assigning to a size variable will attempt to change the particular system
  18. setting (or return an error if an error occurs). The system rounds the value you
  19. give up to the next multiple of the memory page size (on a RiscPC this means
  20. that it will round up to the next 4K) so you may not set the exact size you
  21. actually specify.
  22.  
  23. Reading a free variable gives the current free memory in that part of the
  24. system, and assigning to it tries to increase (or decrease) the free memory to
  25. as close as possible to the size you specify.
  26.  
  27. In both cases after assigning to a variable it is wise to read it again, to see
  28. what memory change actually happened.
  29.  
  30. Note that Module$Free is a little special - Module$Free returns the size of the
  31. largest free block in the RMA, and assigning to it assumes that this block is at
  32. the end of the RMA when it calculates how much to change the RMA size by.
  33. To reliably ensure that you have room for a given module, set Module$Size to
  34. <Module$Size> + size_of_your_module.
  35.  
  36. The 11 variables come as packaged a single utility that creates any combination
  37. given the appropriate command line parameters. One 2K utility uses a lot less
  38. disc space than 11 1K utilities, one for each variable.
  39.  
  40. If you wish to generate all 11 variables use the -All switch - ie
  41.  
  42.     *SizeVar -All
  43.  
  44. To generate all 6 Size variables use the -Size switch. Similarly, to generate
  45. the 5 Free variables use the -Free switch.
  46.  
  47. To specify variables to generate singularly precede the name with '-' and
  48. replace '$' with '_'. For example, to generate Font$Size and Module$Free, call
  49.  
  50.     *SizeVar -Font_Size -Module_Free
  51.  
  52. Size variables can also be specified by the number of their dynamic area - as
  53. the RAMFS is dynamic area 5, to generate RAMFS$Size you can also call
  54.  
  55.     *SizeVar -5
  56.  
  57. (this isn't very user friendly but as the generation code in the utility
  58. actually parses the OS_ReadArgs string to find the variable names and
  59. corresponding dynamic area, it's easier to leave it in and document it!
  60. Confused - see the source code - you will be!)
  61.  
  62. If you want the variables to work in hexadecimal rather than decimal, alter the
  63. flag on 8th line of the BASIC source code and re-assemble.
  64.  
  65. If you want the variables to work in kilobytes rather than bytes (beware of the
  66. rounding effects) see the flag the 10th line of the BASIC source code and
  67. re-assemble.
  68.  
  69. Hopefully the source serves as an example of how to write a transient utility,
  70. and how to write a code variable.
  71.  
  72. I would prefer it it if you distribute the source with the executable
  73. Feel free to use this in anything free. Feel free to modify/improve it.
  74. Feel obliged to send me any bug fixes at <nick@unfortu.net>